1. Field of the Invention
The present invention relates to databases, particularly to techniques for aiding in database query composition.
2. Art Background
The process of constructing a database query is typically an iterative one: A user makes an initial stab at composing a query, submits it to the database system for execution, and inspects the output to determine whether the query had the intended effect. If not, the user revises the query and repeats this process. If queries take a long time to execute (e.g. because the database is large), this process can be very slow.
To avoid this slowness, users sometimes create a side database consisting of a small sample of the original one, for experimentation. Unfortunately, this method does not always work well. For example, suppose the query performs a join of two tables A(x,y) and B(x,z) with the join predicate specifying equality of the two x attributes. If the original data contains many distinct values for x, then it is unlikely that a small sample of A and a small sample of B contain any matching x values. Hence the join query over the sample database may well produce an empty result, even if the query is correct. Similarly, a query with a selective filter executed on a data sample may produce an empty result. In general it can be difficult to test the semantics of a query over a sample database.